package com.animee.day15.slice;

import com.animee.day15.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.Component;

public class MainAbilitySlice extends AbilitySlice implements Component.ClickedListener {
    Button btn1,btn2,btn3,btn4,btn5;
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);
        initView();
    }
    private void initView() {
        btn1 = findComponentById(ResourceTable.Id_main_btn1);
        btn2 = findComponentById(ResourceTable.Id_main_btn2);
        btn3 = findComponentById(ResourceTable.Id_main_btn3);
        btn4 = findComponentById(ResourceTable.Id_main_btn4);
        btn5 = findComponentById(ResourceTable.Id_main_btn5);
        btn1.setClickedListener(this);
        btn2.setClickedListener(this);
        btn3.setClickedListener(this);
        btn4.setClickedListener(this);
        btn5.setClickedListener(this);
    }
    @Override
    public void onClick(Component component) {
        int id = component.getId();
        Intent intent = new Intent();
        switch (id) {
            case ResourceTable.Id_main_btn1:
                present(new LoopPlayAbilitySlice(),intent);
                break;
            case ResourceTable.Id_main_btn2:
                present(new TabAbilitySlice(),intent);
                break;
            case ResourceTable.Id_main_btn3:
                present(new PickerAbilitySlice(),intent);
                break;
            case ResourceTable.Id_main_btn4:

                break;
            case ResourceTable.Id_main_btn5:

                break;
        }
    }
}
